package com.hmall.clients;

import com.hmall.common.dto.PageDTO;
import com.hmall.common.dto.RequestParams;
import com.hmall.common.pojo.Item;
import com.hmall.common.pojo.ItemDoc;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(value = "itemservice")
public interface ItemClient {
    @GetMapping("/item/list")
    PageDTO<Item> list(@RequestParam("page") int page,@RequestParam("size") int size);

    @GetMapping("/item/{id}")
    Item getById(@PathVariable("id") Long id);

    /*@GetMapping("/item/suggestion")
    List<String> suggestion(@RequestParam("key") String key);

    @PostMapping("/item/filters")
    Map<String, List<String>> filters(@RequestBody RequestParams dto);

    @PostMapping("/item/list2")
    PageDTO<ItemDoc> list(@RequestBody RequestParams dto);*/

    @PutMapping("/item/stock/{itemId}/{num}")
    void updateStock(@PathVariable Long itemId,@PathVariable Integer num);

    @PutMapping("/item")
    void update(@RequestBody Item item);
}
